home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Updates / Librarys / MMULib / Install / BuildMMUConfig.rexx next >
OS/2 REXX Batch file  |  1999-11-19  |  14KB  |  350 lines

  1. /*********************************************************
  2.  ** BuildMMUConfig                    **
  3.  **                            **
  4.  ** Builds the MMU-Configuration file automatically    **
  5.  ** from the boards information, including kludges for    **
  6.  ** bad or mis-designed hardware            **
  7.  ** Version 1.04 © 1999 THOR-Software, Thomas Richter   **
  8.  ** 20.11.1999                                          **
  9.  ** with special thanks to Tobias Abt and Niels Knoop    **
  10.  ** for the Board Id's                    **
  11.  *********************************************************/
  12.  
  13. PARSE ARG destination .
  14.  
  15.     if (destination = '') then
  16.         destination = '*'
  17.  
  18.     
  19.     rec = 25;
  20.  
  21.     if (OPEN(.out,destination,'W')) THEN; DO
  22.         rv=WRITELN(.out,";*************************************************************************");
  23.         rv=WRITELN(.out,";** MMU Configuration file                                              **");
  24.         rv=WRITELN(.out,";**                                                                     **");
  25.         rv=WRITELN(.out,";** this file is read on startup by the mmu.library and used to modify  **");
  26.         rv=WRITELN(.out,";** the pre-calculated or scanned MMU table                             **");
  27.         rv=WRITELN(.out,";**                                                                     **");
  28.         rv=WRITELN(.out,";** © 1999 THOR Software, Thomas Richter                                **");
  29.         rv=WRITELN(.out,";*************************************************************************");
  30.         rv=WRITELN(.out,"");
  31.         rv=WRITELN(.out,"");
  32.         rv=WRITELN(.out,"");
  33.         rv=WRITELN(.out,"; the current version of the MMU library knows four commands that can");
  34.         rv=WRITELN(.out,"; be used in this file:");
  35.         rv=WRITELN(.out,"; CLEARTTX clears all or parts of the transparent translation registers");
  36.         rv=WRITELN(.out,"; ADDMEM   adds memory to the exec free list pool. BE WARNED, this command");
  37.         rv=WRITELN(.out,";          does NOT modify the MMU tables, this must be done manually with");
  38.         rv=WRITELN(.out,";          SETCACHEMODE");
  39.         rv=WRITELN(.out,"; SETCACHEMODE  defines the MMU tables.");
  40.         rv=WRITELN(.out,"; DESCRIPTORCACHEINHIBIT defines whether the data cache should be disabled");
  41.         rv=WRITELN(.out,"; for the MMU descriptors. It's usually OFF meaning the cache will remain");
  42.         rv=WRITELN(.out,"; enabled. This is fine for the mmu.library, but certain hacks might require");
  43.         rv=WRITELN(.out,"; an ON argument here. Note that this means more work for the library.");
  44.         rv=WRITELN(.out,"");
  45.         rv=WRITELN(.out,"");
  46.         rv=WRITELN(.out,"ClearTTx        ;ignore all TTX registers if any. We don't need them");
  47.         rv=WRITELN(.out,"");
  48.         rv=WRITELN(.out,";DescriptorCacheInhibit ON    ;make access to MMU descriptors cache inhibited");        
  49.         rv=WRITELN(.out,"");
  50.         rv=WRITELN(.out,"");
  51.         rv=WRITELN(.out,";Board specific setup follows here,");
  52.         rv=WRITELN(.out,";generated by BuildMMUConfig 1.04 © 1999 THOR-Software");
  53.         rv=WRITELN(.out,"");
  54.         ADDRESS COMMAND "ShowBoards to T:BoardInfo";
  55.         if (OPEN(.boardinfo,"T:BoardInfo",'R')) then; do
  56.             rec = 0;
  57.             DO UNTIL EOF(.boardinfo)
  58.                 line = READLN(.boardinfo)
  59.                 IF line ~= '' THEN; DO
  60.                     PARSE VAR line 'Type:' type 'Product:' product 'Manufacturer:' mf 'Serial#:' id 'BoardAddr:' from 'BoardSize:' size;
  61.                     type=X2D(type);
  62.                     product=X2D(product);
  63.                     mf=X2D(mf);
  64.                     id=X2D(id);
  65.                     dfrom=X2D(from);
  66.                     dsize=X2D(size);
  67.                     from=STRIP(from);
  68.                     size=STRIP(size);
  69.                     rv=WRITELN(.out,";Setup for board "mf"/"product);
  70.                     rv=IdentifyBoard(type,product,mf,id,from,size,dfrom,dsize);
  71.                     rv=WRITELN(.out,"");    
  72.                 END
  73.             END    
  74.             rv=CLOSE(.boardinfo);
  75.         END
  76.  
  77.         memfix = 0;
  78.         ppcheck = 0;
  79.         ADDRESS COMMAND 'P5Identify'
  80.         p5mode = RC;
  81.         ADDRESS COMMAND 'FindPort "BOOT-MMU-Port"'
  82.         portmode = RC;
  83.         ADDRESS COMMAND 'FindResident "ppc.library"'
  84.         ppclibmode = RC;
  85.  
  86.         IF ppclibmode = 0 THEN; DO
  87.             ppccheck = 1
  88.         END;
  89.  
  90.         IF portmode = 0 THEN; DO
  91.             ppccheck = 1
  92.         END;
  93.  
  94.         IF p5mode ~= 0 THEN;DO
  95.             WRITELN(.out,"");
  96.             WRITELN(.out,";P5 fixes follow here:");
  97.             WRITELN(.out,";If you do not own a P5 board, you may remove the following lines");
  98.             WRITELN(.out,"");
  99.         END;            
  100.  
  101.  
  102.         IF ppclibmode = 0 THEN; DO
  103.             WRITELN(.out,"");
  104.             WRITELN(.out,";This board has a ppc.library resident. Node that the");
  105.             WRITELN(.out,";mmu.library does NOT support the ppc.library and you");
  106.             WRITELN(.out,";MUST NOT use it.");
  107.             WRITELN(.out,"");
  108.             SAY "Warning! The setup script found the ppc.library resident.";
  109.             SAY "Note that the mmu.library does not support the ppc.library";
  110.             SAY "and that this combination will not operate properly unless";
  111.             SAY "you replace the ppc.library by WarpOs";
  112.         END;
  113.  
  114.         IF portmode = 0 THEN;DO
  115.             WRITELN(.out,"");
  116.             WRITELN(.out,";Several P5 boards build a private MMU setup on boot");
  117.             WRITELN(.out,";using a kludge called the BOOT-MMU-Port. To run this");
  118.             WRITELN(.out,";kludge, the following external command is run from");
  119.             WRITELN(.out,";LIBS:mmu/ as all other external commands");
  120.             WRITELN(.out,"ScanMMUPort");
  121.             SAY "Copying the file ScanMMUPort to LIBS:mmu/ScanMMUPort for the setup";
  122.             OPTIONS FAILAT 15
  123.             ADDRESS COMMAND 'MakeDir >NIL: LIBS:MMU/'
  124.             OPTIONS FAILAT 10
  125.             ADDRESS COMMAND 'Copy >NIL: ScanMMUPort to LIBS:MMU/ScanMMUPort'
  126.             WRITELN(.out,";SetCacheMode FROM 0xFFFF8000 SIZE 0x00008000 VALID CACHEINHIBIT");
  127.             WRITELN(.out,"");
  128.         END;
  129.  
  130.         IF p5mode = 1 THEN;DO
  131.             rv=WRITELN(.out,"");
  132.             rv=WRITELN(.out,";Several P5 boards need the following to be set:");
  133.             rv=WRITELN(.out,"SetCacheMode FROM 0xfff00000 SIZE 0x00020000 VALID CACHEINHIBIT");
  134.             rv=WRITELN(.out,"SetCacheMode FROM 0x00f00000 SIZE 0x00080000 VALID WRITETHROUGH");
  135.             rv=WRITELN(.out,"");
  136.         END;
  137.  
  138.         IF p5mode = 2 THEN; DO
  139.             rv=WRITELN(.out,"");
  140.             rv=WRITELN(.out,";CyberStorm PPC board memory setup follows here:");
  141.             rv=WRITELN(.out,"SetCacheMode FROM 0xfff00000 SIZE 0x00080000 VALID CACHEINHIBIT");
  142.             rv=WRITELN(.out,"SetCacheMode FROM 0x00f00000 SIZE 0x00050000 VALID CACHEINHIBIT");
  143.             rv=WRITELN(.out,"SetCacheMode FROM 0x00f60000 SIZE 0x00020000 VALID CACHEINHIBIT");
  144.             ppccheck = 1;
  145.             memfix = 1;
  146.         END;
  147.  
  148.         IF p5mode = 3 THEN; DO
  149.             rv=WRITELN(.out,"");
  150.             rv=WRITELN(.out,";CyberStorm MK3 board memory setup follows here:");
  151.             rv=WRITELN(.out,"SetCacheMode FROM 0x00f00000 SIZE 0x00050000 VALID CACHEINHIBIT");
  152.             rv=WRITELN(.out,"SetCacheMode FROM 0x00f60000 SIZE 0x00020000 VALID CACHEINHIBIT");
  153.             ppccheck = 1;
  154.             memfix = 1;
  155.         END;
  156.  
  157.         IF p5mode = 4 THEN; DO
  158.             rv=WRITELN(.out,"");
  159.             rv=WRITELN(.out,";Blizzard PPC board memory setup follows here:");
  160.             rv=WRITELN(.out,"SetCacheMode FROM 0xfff00000 SIZE 0x00080000 VALID CACHEINHIBIT");
  161.             rv=WRITELN(.out,"SetCacheMode FROM 0x00f00000 SIZE 0x00080000 VALID CACHEINHIBIT");
  162.             ppccheck = 1;
  163.             memfix = 2;
  164.         END;
  165.  
  166.         IF ppccheck = 1 THEN; DO
  167.             ADDRESS COMMAND 'PPCIdentify'
  168.             ppccheck = RC;
  169.         END;
  170.  
  171.         IF ppccheck = 1 THEN; DO
  172.             rv=WRITELN(.out,";More P5 PPC setups:");
  173.             rv=WRITELN(.out,"SetCacheMode FROM 0xe0000000 SIZE 0x01000000 VALID CACHEINHIBIT IMPRECISE NONSERIAL");
  174.             rv=WRITELN(.out,"SetCacheMode FROM 0xef000000 SIZE 0x00020000 VALID CACHEINHIBIT");
  175.             rv=WRITELN(.out,"SetCacheMode FROM 0xfff80000 SIZE 0x00020000 VALID CACHEINHIBIT");
  176.             rv=WRITELN(.out,"SetCacheMode FROM 0xfffc0000 SIZE 0x00040000 VALID CACHEINHIBIT");
  177.         END;
  178.  
  179.         IF memfix ~= 0 THEN; DO
  180.             rv=WRITELN(.out,"");
  181.             rv=WRITELN(.out,";Even more P5 memory fixes. If the following memory is in your");
  182.             rv=WRITELN(.out,";memory free list, this should be marked as cache-inhibited");
  183.             rv=WRITELN(.out,";possibly because of bus logic problems. Note that setting the cache");
  184.             rv=WRITELN(.out,";cache mode does not validate the access.");
  185.             IF memfix = 1 THEN; DO
  186.                 rv=WRITELN(.out,"SETCACHEMODE FROM 0x08000000 SIZE 0x08000000 CACHEINHIBIT");
  187.             END; 
  188.             IF memfix = 2 THEN; DO
  189.                 rv=WRITELN(.out,"SETCACHEMODE FROM 0x40000000 SIZE 0x80000000 CACHEINHIBIT");
  190.             END;
  191.             rv=WRITELN(.out,"");
  192.         END
  193.  
  194.         rv=WRITELN(.out,"");
  195.         rv=CLOSE(.out);
  196.         ADDRESS COMMAND 'Delete T:BoardInfo QUIET'
  197.     END    
  198.  
  199. EXIT rec
  200.  
  201. IdentifyBoard:    PROCEDURE
  202. PARSE ARG type,product,mf,id,xfrom,xsize,from,size
  203.  
  204.     IF BitExtract(type,5) = '1' THEN; DO
  205.         rv=WRITELN(.out,";This board contains memory and requires no special threadment.");
  206.